package com.fwmagic.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @description:
 * @author: fangwei
 * @date: 2022/3/31
 **/
@RestController
@Slf4j
@RequestMapping("order")
public class OrderController {

    public final static String INVODE_URL = "http://cloud-provider-payment";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/zk")
    public Object getZk() {
        String result = this.restTemplate.getForObject(INVODE_URL + "/payment/zk", String.class);
        log.info("消费者调用支付服务（zookeeper）---> result:{}",result);
        return result;
    }

}
